var  app = getApp();
var P = require('../../utils/wxpage');
let utils=require('../../utils/utils');

var  detailCp = require('../../wxpage/tabBar/tabBar.js');
P('index',{
  comps:[detailCp],
  data: {
    // swipe的小点 默认true
    indicatorDots: true,
    // 滚动模式  
    vertical: false,
    // 自动播放吗
    autoplay: true,
    circular: true,
    interval: 3000,
    duration: 500,
    items: [],
    cardIcon: '../../image/cardbag.png',
    cartIcon: '../../image/cart.png'
  },

  onLoad: function() {
    console.log('首页加载---------------------------------');
    var that=this;
    // app.getShopconf(function () {
    //   that.setData({
    //     banner: app.globalData.appData.banner,
    //     who: app.globalData.who,
    //     commonURL: app.globalData.commonURL,
    //     shopData: app.globalData.appData
    //   });
    //   app.setNavigationBarTitle(app.globalData.appData.shopName);
    // });
      that.setData({
                  banner: app.globalData.appData.banner,
                  who: app.globalData.who,
                  commonURL: app.globalData.commonURL,
                  shopData: app.globalData.appData
                });

  },
    onShow:function(){
        //获得购物车数量
        utils.getCart(this,false);
    },

  //监听下拉
  onPullDownRefresh:function(){
    console.log("下拉刷新");
    wx.stopPullDownRefresh();
  },
  toOrderList: function() {
    wx.navigateTo({
      url: '/pages/user-order-list/index?type=5'
    })
  },
  toSelectKFC: function (e) {
    wx.navigateTo({
      url: '/pages/menu/menu'
    })
  },
  //分享
  onShareAppMessage: function () {
    return {
      title: app.globalData.appData.sharetitle || "发现一家有趣的小程序，和你分享一下",
      path: "/pages/index/index"
    }
  },
})
